<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>监管结果记录</title>
	<script src="../js/header.js"></script>
	<style type="text/css">
		html, body, #app {
			padding: 0px;
			margin: 0px;
		}
		#app {
			border-top: 3px solid #0D9AFF;
			padding: 25px;
		}
		.el-select ,.el-date-editor.el-input, .el-date-editor.el-input__inner {
			width: 100%;
		}
	</style>
</head>

<body>
<div v-cloak id="app">
	<div style="margin-top: 10px; border-bottom:1px solid rgba(200,200,200,0.43);">
		<!--搜索栏-->
		<el-form :model="selectForm" ref="selectForm" label-width="150px">
			<el-row>
				<el-col :span="6">
					<el-form-item label="创建人:" prop="createUser" label-width="100px">
						<el-input v-model="selectForm.createUser" style="width: 250px;"
								  placeholder=""></el-input>
					</el-form-item>
				</el-col>
				<el-col span="6">
					<el-form-item label="创建人单位:" prop="createUserUnit" label-width="100px">
						<el-select v-model.trim="selectForm.createUserUnit" placeholder="" style="width: 250px;">
							<el-option
									v-for="item in orgList"
									:key="item.appId"
									:label="item.dictName"
									:value="item.dictName">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col span="12">
					<el-form-item label="创建时间:" label-width="110px">
						<el-row>
							<el-col span="6" style="width: 180px;">
								<el-form-item prop="startDate">
									<el-date-picker type="date" placeholder="选择日期" v-model="selectForm.startDate"
													value-format="yyyy-MM-dd" style="width: 180px;"@change="changeval()"
													:editable="false">
									</el-date-picker>
								</el-form-item>
							</el-col>
							<el-col span="1" style="color: rgb(192, 204, 218);text-align: center;">
								<span>—</span>
							</el-col>
							<el-col span="5">
								<el-form-item prop="endDate">
									<el-date-picker type="date" placeholder="选择日期" v-model="selectForm.endDate"
													value-format="yyyy-MM-dd" style="width: 180px;"@change="changeval()"
													:editable="false">
									</el-date-picker>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form-item>
				</el-col>
			</el-row>

			<el-row>
				<el-col :span="6">
					<el-form-item label="标题:"  prop="title" label-width="100px">
						<el-input v-model="selectForm.title" style="width: 250px;"
                                  placeholder=""></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="6">
                    <el-form-item label="监管对象名称:" prop="supervisionObjectName" label-width="100px">
                        <el-input v-model="selectForm.supervisionObjectName" style="width: 250px;"
                                  placeholder=""></el-input>
                    </el-form-item>
                </el-col>
				<!--<el-col :span="7">
                  <el-form-item label="上报状态:" style="width: 330px;" label-width="100px" prop="reportstatus">
                      <el-select v-model="selectForm.reportstatus" placeholder="请选择" style="width: 250px;">
                          <el-option label="未上报" value="0"></el-option>
                          <el-option label="已上报" value="1"></el-option>
                      </el-select>
                 </el-form-item>
                </el-col>-->
				<div style="float: right;">
					<el-button  type="primary" size="small" style="width: 60px;height: 30px;" @click="apply">新增
					</el-button>
					<el-button type="primary" size="small" style="width: 60px;height: 30px;"
							   @click="searchForm('selectForm')">查询
					</el-button>
					<el-button type="warning" size="small" style="width: 60px;height: 30px;"
							   @click="resetForm1('selectForm')">重置
					</el-button>
				</div>

			</el-row>
		</el-form>
	</div>

	<el-table :data="supervisionrecord" border style="width: 100%;margin-top: 35px;"
			  :header-cell-style="{background:'#eef1f6',color:'#606266'}">
		<!--<el-table-column type="selection"></el-table-column>-->
		<el-table-column
				:resizable="false"
				type="index"
				label="序号"
				width="60" align="center">
		</el-table-column>
		<el-table-column
				prop="createUser"
				label="创建人"
				width="150"
				align="center">
		</el-table-column>
		<el-table-column
	            prop="createUserUnit"
	            label="创建人单位"
	            width="230"
	            align="center">
        </el-table-column>
        <el-table-column
	            prop="createTime"
	            label="创建时间"
	            width="150"
	            align="center">
        </el-table-column>
		<el-table-column
				prop="title"
				label="标题"
				width="250"
				align="center">
		</el-table-column>
		<el-table-column
				prop="supervisionObjectName"
				label="监管对象名称"
				width="250"
				align="center">
		</el-table-column>
		<el-table-column
				prop="status"
				label="状态"
				width="130"
				align="center">
			<template slot-scope="scope">
				<span v-if="scope.row.status==0" style="color:#F19437;">暂存</span>
				<span v-if="scope.row.status==1" style="color:#20A0FF;">已提交</span>
				<!--<span v-if="scope.row.status==2" style="color:#FF4949;">审核未通过</span>
				<span v-if="scope.row.status==3" style="color:#67C23A;">审核已通过</span>-->
			</template>
		</el-table-column>		
		<el-table-column
				label="操作"
				width=""
				align="center">
			<template slot-scope="scope">
				<span v-if="scope.row.status==0">
					<el-button size="mini" @click="view(scope.$index,scope.row)">查看</el-button>
					<el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)">修改</el-button>
					<el-button type="danger" size="mini" @click="del(scope.$index,scope.row)">删除</el-button>
					<el-button type="success" size="mini" @click="submit(scope.$index,scope.row)">提交</el-button>
				</span>
				<span v-if="scope.row.status==1">
					<el-button size="mini" @click="view(scope.$index,scope.row)">查看</el-button>
					<el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)" disabled>修改</el-button>
					<el-button type="danger" size="mini" @click="del(scope.$index,scope.row)" disabled>删除</el-button>
					<el-button type="success" size="mini" @click="submit(scope.$index,scope.row)" disabled>提交</el-button>
				</span>
			</template>
		</el-table-column>
	</el-table>
	<div style="overflow: hidden;">
		<div class="pagination">
			<el-pagination
					@size-change="handleSizeChange"
					@current-change="handleCurrentChange"
					:current-page="currentPage"
					:page-sizes="[10, 20, 30, 40]"
					:page-size="pagesize"
					background
					layout="total, sizes,prev, pager, next"
					:total="tableTotal"
					prev-text="上一页"
					next-text="下一页">
			</el-pagination>
			<el-button type="primary" size="mini" @click="appovalEx()" style="float: right;">批量导出</el-button>
		</div>
	</div>
	
	<!--新增弹窗-->
	<el-dialog title="" :visible.sync="newdialogForm" center fullscreen>
		<div style="margin-top: 10px;">
			<el-form :model="newsupervisionrecord" :rules="rules" ref="newsupervisionrecord" label-width="140px">
				<el-row>
					<el-col :span="4" class="tab-title">
						监管结果记录
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="14">
						<el-form-item label="标题:" prop="title" label-width="110px">
							<el-input v-model.trim="newsupervisionrecord.title" placeholder="" style="" :maxlength="120"
									  show-word-limit></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建人:" prop="createUser" label-width="110px">
							<el-input v-model.trim="newsupervisionrecord.createUser" placeholder="" disabled ></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="创建人单位:" prop="createUserUnit" label-width="110px">
							<!--<el-input v-model="newsupervisionrecord.createUserUnit" placeholder=""></el-input>-->
							<el-select v-model.trim="newsupervisionrecord.createUserUnit" placeholder="" disabled>
								<el-option
										v-for="item in orgList"
										:key="item.appId"
										:label="item.dictName"
										:value="item.dictName">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建时间:" prop="createTime" label-width="110px">
							<el-date-picker type="date" placeholder="" v-model="newsupervisionrecord.createTime"
													value-format="yyyy-MM-dd" disabled>
									</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="监管对象名称:" prop="supervisionObjectName" label-width="110px">
							<el-input v-model.trim="newsupervisionrecord.supervisionObjectName" placeholder="" :maxlength="50"
									  show-word-limit></el-input>
						</el-form-item>
					</el-col>
				</el-row>					
				<el-row>
					<el-col :span="22">
						<el-form-item label="监管情况记录:" prop="supervisionRecordContent" label-width="110px">
							<el-input
									type="textarea"
									:autosize="{ minRows: 8, maxRows: 8}"
									placeholder=""
									maxlength="500"
									show-word-limit
									v-model="newsupervisionrecord.supervisionRecordContent">
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>						
					<el-col :span="22">
						<el-form-item label="附件:" prop="" label-width="110px">						
							<iframe width="100%"  style="height: 320px;border: none;"   :src="link" scrolling="no"></iframe>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="22">
						<div style="float:right;">
							<el-button type="primary" size="small" style="width: 60px;height: 30px;"
									   @click="newonSubmit('newsupervisionrecord')">
								暂存
							</el-button>
							<el-button type="primary" size="small" style="width: 60px;height: 30px;"
									   @click="saveonSubmit('newsupervisionrecord')">提交
							</el-button>
							<el-button type="info" size="small" style="width: 60px;height: 30px;"
									   @click="newdialogForm = false;cancel();resetForm('newsupervisionrecord')">取消
							</el-button>
						</div>
					</el-col>
				</el-row>
			</el-form>
		</div>
	</el-dialog>
	<!--查看详情弹窗-->
	<el-dialog title="" :visible.sync="viewdialogForm" center fullscreen>
		<div style="margin-top: 0px;">
			<el-form :model="viewsupervisionrecord" :rules="rules" ref="viewrecordProject" label-width="140px">
				<el-row>
					<el-col :span="4" class="tab-title">
						监管结果记录
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="14">
						<el-form-item label="标题:" prop="title" label-width="110px">
							<el-input v-model="viewsupervisionrecord.title" placeholder="" style="" disabled></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建人:" prop="createUser" label-width="110px">
							<el-input v-model="viewsupervisionrecord.createUser" placeholder="" disabled></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="创建人单位:" prop="createUserUnit" label-width="110px">
							<!--<el-input v-model="viewsupervisionrecord.createUserUnit" placeholder="" disabled></el-input>-->
							<el-select v-model="viewsupervisionrecord.createUserUnit" placeholder="" disabled>
								<el-option
										v-for="item in orgList"
										:key="item.appId"
										:label="item.dictName"
										:value="item.dictName">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>					
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建时间:" prop="createTime" label-width="110px">
							<el-date-picker type="date" placeholder="" v-model="viewsupervisionrecord.createTime"
													value-format="yyyy-MM-dd" disabled>
									</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="监管对象名称:" prop="supervisionObjectName" label-width="110px">
							<el-input v-model="viewsupervisionrecord.supervisionObjectName" placeholder="" disabled></el-input>
						</el-form-item>
					</el-col>
				</el-row>					
				<el-row>
					<el-col :span="22">
						<el-form-item label="监管情况记录:" prop="supervisionRecordContent" label-width="110px">
							<el-input
									disabled
									type="textarea"
									:autosize="{ minRows: 8, maxRows: 8}"
									placeholder=""
									maxlength="500"
									show-word-limit
									v-model="viewsupervisionrecord.supervisionRecordContent">
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>						
					<el-col :span="22">
						<el-form-item label="附件:" prop="" label-width="110px">						
							<iframe width="100%"  style="height: 200px;border: none;"   :src="link" disabled></iframe>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="22">
						<div style="float:right;">
							<el-button type="info" size="small" style="width: 60px;height: 30px;"
									   @click="viewdialogForm = false">关闭
							</el-button>
						</div>
					</el-col>
				</el-row>
			</el-form>
		</div>
	</el-dialog>

	<!--编辑修改-->
	<el-dialog title="" :visible.sync="editdialogForm" center fullscreen>
		<div style="margin-top: 0px;">
			<el-form :model="editsupervisionrecord" :rules="rules" ref="editsupervisionrecord" label-width="140px">
				<el-row>
					<el-col :span="4" class="tab-title">
						监管结果记录
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="14">
						<el-form-item label="标题:" prop="title" label-width="110px">
							<el-input v-model.trim="editsupervisionrecord.title" placeholder="" style="" :maxlength="120"
									  show-word-limit></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建人:" prop="createUser" label-width="110px">
							<el-input v-model.trim="editsupervisionrecord.createUser" placeholder="" disabled :maxlength="50"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="创建人单位:" prop="createUserUnit" label-width="110px">
							<!--<el-input v-model="editsupervisionrecord.createUserUnit" placeholder=""></el-input>-->
							<el-select v-model.trim="editsupervisionrecord.createUserUnit" placeholder="" disabled>
								<el-option
										v-for="item in orgList"
										:key="item.appId"
										:label="item.dictName"
										:value="item.dictName">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>					
				</el-row>
				<el-row>
					<el-col :span="7">
						<el-form-item label="创建时间:" prop="createTime" label-width="110px">
							<el-date-picker type="date" placeholder="" v-model="editsupervisionrecord.createTime"
													value-format="yyyy-MM-dd" disabled
							>
									</el-date-picker>
						</el-form-item>
					</el-col>
					<el-col :span="7">
						<el-form-item label="监管对象名称:" prop="supervisionObjectName" label-width="110px">
							<el-input v-model.trim="editsupervisionrecord.supervisionObjectName" placeholder="" :maxlength="50"
									  show-word-limit></el-input>
						</el-form-item>
					</el-col>
				</el-row>					
				<el-row>
					<el-col :span="22">
						<el-form-item label="监管情况记录:" prop="supervisionRecordContent" label-width="110px">
							<el-input
									type="textarea"
									:autosize="{ minRows: 8, maxRows: 8}"
									placeholder=""
									maxlength="500"
									show-word-limit
									v-model="editsupervisionrecord.supervisionRecordContent">
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>						
					<el-col :span="22">
						<el-form-item label="附件:" prop="" label-width="110px">						
							<iframe width="100%"  style="height: 320px;border: none;" scolling="no"  :src="link"></iframe>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="22">
						<div style="float:right;">
							<el-button type="primary" size="small" style="width: 60px;height: 30px;"
									   @click="editonSubmit('editsupervisionrecord')">修改
							</el-button>
							<el-button type="info" size="small" style="width: 60px;height: 30px;"
									   @click="resetForm('editsupervisionrecord');editdialogForm = false">取消
							</el-button>
						</div>
					</el-col>
				</el-row>
			</el-form>
		</div>
	</el-dialog>	
</div>
<script>
    var vm = new Vue({
        el: '#app',
        data() {
            //验证电话号码
            let checkMobile = (rule, value, callback) => {
                if (!this.checkTel(value)) {
                    callback(new Error('电话号码不合法，请输入XXXX-XXXXXXX或XXX-XXXXXXXX格式'));
                } else {
                    callback();
                }
            };
			//验证数值
            let checkNumber= (rule, value, callback)=>{
                if(!this.checkNum(value)){
                    callback(new Error('请输入非负数数值'));
				}else {
                    callback();
                }
			};
            //验证营业执照或三证合一
            let checkICard= (rule, value, callback)=>{
                if(this.checkCard(value)){
                    callback(new Error('请输入非负数数值'));
                }else {
                    callback();
                }
            };
            return {
                orgLevel:'',
                userName:'',
                orgName:'',
				orgList : [],
                uuid:'',
                link:'',
                currentPage: 1, //默认显示页面为1
                pagesize: 10, // 每页的数据条数
                currentPage1: 1,
                pagesize1: 5,
                tableTotal1:'',
                newdialogForm: false,//新增申请弹窗
                viewdialogForm: false,//查看详情弹窗
                editdialogForm: false,//编辑修改弹窗
                checkdialogForm: false,//审核弹窗
                dialogGongGaoForm: false, //拟制公告弹窗
                dialogGongGaoViewForm: false, // 查看公告弹窗
                LandType:'',//控制区域内拟建重大工程字段是否必填
                tableTotal: '',
                address:[{
                	provinceValue:'',
	                cityValue:'',
	                areaValue:'',
                	provinceData:[],
                	cityData:[],
                	areaData:[]
                }],          
                selectForm: {
                    createUser: '',
                    createUserUnit: '',
                    startDate: '',
                    endDate: '',
                    status: '',
                    title: '',
                    supervisionObjectName:''
                },
                Form: {
                    createUser: '',
                    createUserUnit: '',
                    startDate: '',
                    endDate: '',
                    status: '',
                    title: '',
                    supervisionObjectName:''
                },
                supervisionrecord: {
                    title: '',
                    createUser: '',
                    createUserUnit: '',
                    createTime: '',
                    supervisionObjectName: '',
                    supervisionRecordContent: '',
                   	status: ''
                },
                viewsupervisionrecord: {
                    title: '',
                    createUser: '',
                    createUserUnit: '',
                    createTime: '',
                    supervisionObjectName: '',
                    supervisionRecordContent: '',
                   	status: ''
                },
                newsupervisionrecord: {
                    title: '',
                    createUser: '',
                    createUserUnit: '',
                    createTime: '',
                    supervisionObjectName: '',
                    supervisionRecordContent: '',
                   	status: ''
                },
                editsupervisionrecord: {
                    title: '',
                    createUser: '',
                    createUserUnit: '',
                    createTime: '',
                    supervisionObjectName: '',
                    supervisionRecordContent: '',
                   	status: ''
                },

                dialogFormVisible: false,
                currentRow: null,
                rules: {
                    title: [{
                        required: true,
                        message: '请输入标题',
                        trigger: 'blur'
                    }],
                    createUser: [{
                        required: true,
                        message: '请输入创建人',
                        trigger: 'blur'
                    }],
                    createUserUnit: [{
                        required: true,
                        message: '请输入创建单位',
                        trigger: 'blur'
                    }],
                    createTime: [{
                        required: true,
                        message: '请选择日期',
                        trigger: 'change'
                    }],
                    supervisionRecordContent: [{
                        required: true,
                        message: '请输入监管情况记录',
                        trigger: 'blur'
                    }]
                }
            }

        },
        created() {
            // 获取登录用户信息
            var userInfo = JSON.parse(localStorage.getItem('userInfo'));
            this.orgLevel = userInfo.orgLevel;
            // 中国地震局 ==> 中国, 山东省-济南市地震局 ==> 山东省-济南市
            this.orgName = userInfo.orgName;
            this.userName=userInfo.loginName;

            axios.post('/dzjdzqs/dict/getdict/d_org').then(res => {
                this.orgList = res.data.data.result;
            }).catch(e => {
                this.$message.error("网络连接超时");
            });
        },
        mounted() {
            this.getData();
        },
        methods: {
            getData() {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;
                axios({
                    method: 'get',
                    url: '/dzjdzqs/supervision/publicityList',
                    params: {
                    	createUser: this.Form.createUser.trim(),
                        title: this.Form.title.trim(),
                        supervisionObjectName:this.Form.supervisionObjectName.trim(),
                        createUserUnit: this.Form.createUserUnit,
                        status: this.Form.status,
                        releaseStartTime: this.Form.startDate,
                        releaseEndTime: this.Form.endDate,
                        pageSize: pagesize,
                        pageNo: pageno
                    }
                })
                    .then(response => {
                        console.log(response)
                        if (response.data.code == 200) {
                            console.log(response.data.data.results)
                            this.supervisionrecord = response.data.data.results;
                            this.tableTotal = response.data.data.total;
                        } else {
                            this.$message.error(response.data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            changeval(){
                if(this.selectForm.endDate != ''){
                    if(this.selectForm.startDate > this.selectForm.endDate){
                        this.$message.error("开始时间必须小于结束日期");
                        return;
                    }
                }
                if(this.selectForm.startDate != ''&& this.selectForm.endDate != '' ){
                    if(this.selectForm.startDate > this.selectForm.endDate){
                        this.$message.error("开始时间必须小于结束日期");
                        return;
                    }
                }

            },
            searchForm() {
                this.Form=this.selectForm;
                this.currentPage = 1;
                axios({
                    method: 'get',
                    url: '/dzjdzqs/supervision/publicityList',
                    params: {
                        createUser: this.Form.createUser.trim(),
                        title: this.Form.title.trim(),
                        supervisionObjectName:this.Form.supervisionObjectName.trim(),
                        createUserUnit: this.Form.createUserUnit,
                        status: this.Form.status,
                        releaseStartTime: this.Form.startDate,
                        releaseEndTime: this.Form.endDate,
                        pageSize: this.pagesize,
                        pageNo: this.currentPage
                    }
                })
                    .then(response => {
                        console.log(response)
                        if (response.data.code == 200) {
                            console.log(response.data.data.results)
                            this.supervisionrecord = response.data.data.results;
                            this.tableTotal = response.data.data.total;
                        } else {
                            this.$message.error(response.data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            //获取UUID的方法
            getUuid() {
                axios({
                    method: 'get',
                    url: '/dzjdzqs/uuid/getUuid',
                })
                    .then(response => {
                        console.log(response);
                        if (response.data.code == 200) {
                            this.uuid = response.data.data;
                            this.link="upload/annex.html?uuid="+this.uuid+"&flag=1";
                            console.log(this.uuid);
                        } else {
                            this.$message.error(response.data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },
            /* 单选搜索表单 */
            selectCurrentChange(val){
                this.currentRow = val;
            },
            //点击第几页
            handleCurrentChange1(currentPage) {
                this.currentPage1 = currentPage;
                this.onSearch();
            },
            //重置
            resetForm1(formName) {
                this.$refs[formName].resetFields();
                this.Form.createUser = '';
                this.Form.createUserUnit = '';
                this.Form.startDate = '';
                this.Form.endDate = '';
                this.Form.status = '';
                this.Form.title = '';
                this.Form.supervisionObjectName = '';
                this.searchForm();
            },
            //取消
            resetForm(formName) {
                this.$refs[formName].resetFields();
            },
            //每页下拉显示数据
            handleSizeChange: function (size) {
                this.pagesize = size;
                this.getData();
                /*console.log(this.pagesize) */
            },
            //点击第几页
            handleCurrentChange: function (currentPage) {
                this.currentPage = currentPage;
                this.getData();
                /*console.log(this.currentPage) */
            },
            apply() {
                this.newdialogForm = true;
                this.cancel();
                this.getUuid();
                let date = new Date();
                let y = date.getFullYear();
                let MM = date.getMonth() + 1;
                MM = MM < 10 ? ('0' + MM) : MM;
                let d = date.getDate();
                d = d < 10 ? ('0' + d) : d;
                let h = date.getHours();
                h = h < 10 ? ('0' + h) : h;
                let m = date.getMinutes();
                m = m < 10 ? ('0' + m) : m;
                let s = date.getSeconds();
                s = s < 10 ? ('0' + s) : s;
               	console.log(y + '-' + MM + '-' + d);
               	this.newsupervisionrecord.createTime = y + '-' + MM + '-' + d;
				this.newsupervisionrecord.createUser = this.userName;
				this.newsupervisionrecord.createUserUnit = this.orgName;
            },
            // 暂存
            newonSubmit(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                    	this.newsupervisionrecord.id=this.uuid;
                    	//this.newsupervisionrecord.createTime = '';
                        axios({
                            method: 'post',
                            url: '/dzjdzqs/supervision/saveOnly',
                            data: this.newsupervisionrecord
                        }).then((res) => {
                            console.log(res);
                            if (res.data.code == 200) {
                                // 提交成功将要执行的代码
                                // this.recordProject.push(this.newrecordProject);
                                this.getData();
                                this.$message({
                                    message: '暂存成功',
                                    type: 'success'
                                });
                                this.newdialogForm = false;
								this.cancel();
                            }
                        });
                    } else {
                        console.log("error!!");
                        return false;
                    }
                });
            },
            // 保存，并且设置状态已提交
            saveonSubmit(formName) {
                console.log(this.newsupervisionrecord);
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                    	this.newsupervisionrecord.id=this.uuid;
                        //this.newsupervisionrecord.createTime = '';
                        axios({
                            method: 'post',
                            url: '/dzjdzqs/supervision/save',
                            data: this.newsupervisionrecord
                        }).then((res) => {
                            console.log(res);
                            if (res.data.code == 200) {
                                // 提交成功将要执行的代码
                                // this.commonproject.push(this.newcommonproject);
                                this.getData();
                                this.$message({
                                    message: '提交成功',
                                    type: 'success'
                                });
                                // 表单置空
                                this.cancel();
                                this.newdialogForm = false;
                            }
                        })
                    } else {
                        console.log("error!!");
                        return false;
                    }
                });
            },
            cancel(){
                this.newsupervisionrecord = {
                    title: '',
                    createUser: '',
                    createUserUnit: '',
                    createTime: '',
                    supervisionObjectName: '',
                    supervisionRecordContent: '',
                   	status: ''
                }
            },
            //导出
            appovalEx(){
            	this.$confirm('确定要导出吗?', '提示', {
                    cancelButtonText: '取消',
                    confirmButtonText: '确定',
                    type: 'warning'
               }).then(() => {               	
	                window.location.href="/dzjdzqs/supervision/export?createUser="+this.selectForm.createUser+"&title="
	                    +this.selectForm.title+"&supervisionObjectName="
	                    +this.selectForm.supervisionObjectName+"&createUserUnit="
	                    +this.selectForm.createUserUnit+"&status="
	                    +this.selectForm.status+"&releaseStartTime="
	                    +this.selectForm.startDate+"&releaseEndTime="
	                    +this.selectForm.endDate;
	            }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消导出'
                    });
                });
            },
            view(index, row) {
            	this.uuid=row.id;
                this.link="upload/annex.html?uuid="+this.uuid+"&flag=0";
            	this.viewdialogForm = true;
                this.viewsupervisionrecord = row;

            },
            edit(index, row) {
            	this.uuid=row.id;
                this.link="upload/annex.html?uuid="+this.uuid+"&flag=1"
                this.editdialogForm = true;
                this.editsupervisionrecord = row;

            },
            // 修改
            editonSubmit(formName) {
            	console.log(this.editsupervisionrecord)
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        axios({
                            method: 'post',
                            url: '/dzjdzqs/supervision/update',
                            // data中必须有id
                            data: this.editsupervisionrecord
                        }).then((res) => {
                            console.log(res);
                            if (res.data.code == 200) {
                                // 提交成功将要执行的代码
                                this.getData();
                                this.$message({
                                    message: '修改成功',
                                    type: 'success'
                                });
                                this.editdialogForm = false;
                            }
                        });
                    } else {
                        console.log("error!!");
                        return false;
                    }
                });
            },
            // 操作按钮的提交
            submit(index, row) {
                this.$confirm('确定要提交吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios({
                        method: 'get',
                        url: '/dzjdzqs/supervision/submit',
                        params:{
                            id: row.id
                        }
                    }).then((res) => {
                        console.log(res.data);
                        if (res.data.code == 200) {
                            // 提交成功将要执行的代码
                            console.log(res.data.msg);
                            this.getData();
                            this.$message({
                                type: 'success',
                                message: '提交成功!'
                            });
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消提交'
                    });
                });
            },
            // 操作按钮的撤回
            cancelRecord(index, row) {
                this.$confirm('确定要撤回吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios({
                              method: 'post',
                              url: '/dzjap/regionrecord/cancel/' + row.recordId,
                    data:{
                    recordId: row.recordId,
                        status: '0'
                }
            }).then((res) => {
                    console.log(res.data);
                if (res.data.code == 200) {
                    // 撤回成功将要执行的代码
                    console.log(res.data.msg);
                    this.getData();
                    this.$message({
                        type: 'success',
                        message: '撤回成功!'
                    });
                }
            });
            }).catch(() => {
                    this.$message({
                    type: 'info',
                    message: '撤回提交'
                });
            });
            },
            // 审核提交
            checkonSubmit() {
                console.log(this.checksupervisionrecord.recordId);
                axios({
                    method: 'post',
                    url: '/dzjap/regionrecord/check/' + this.checksupervisionrecord.recordId,
                    // data中必须有recordId
                    data: this.checksupervisionrecord
                }).then((res) => {
                    console.log(res);
                    if (res.data.code == 200) {
                        // 提交成功将要执行的代码
                        this.getData();
                        this.$message({
                            message: '成功',
                            type: 'success'
                        });
                        this.checkdialogForm = false;
                    }
                });
            },
            // 删除
            del(index, row) {

                var pagesize = this.pagesize;
                var pageno = this.currentPage;
                var afterPage =  Math.floor( this.tableTotal / pagesize);
                var nowSize  = this.tableTotal % pagesize;
                this.$confirm('确定要删除吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios({
                        method: 'post',
                        url: '/dzjdzqs/supervision/delete/' + row.id,
                    }).then((res) => {
                        console.log(res);
                        if (res.data.code == 200) {
                            this.supervisionrecord.splice(index, 1);
                            this.$message({
                                type: 'success',
                                message: '删除成功!'
                            });
                            if(nowSize =='1' && afterPage >='0'){
                                this.currentPage = afterPage;
                                this.getData();
                            }else {
                                this.getData();
                            }
                        }
                        else {
                            this.$message.error(data.msg);
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消删除'
                    });
                });
            },
            // 上报
            report(index, row) {
                this.$confirm('确定要上报吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    axios({
                        method: 'post',
                        url: '/dzjap/regionrecord/report/' + row.recordId,
                        data: row
                    }).then((res) => {
                        console.log(res.data);
                        if (res.data.code == 200) {
                            // 提交成功将要执行的代码
                            console.log(res.data.msg);
                            this.getData();
                            this.$message({
                                type: 'success',
                                message: '已上报!'
                            });
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消上报'
                    });
                });
            },
            // 审核
            check(index, row) {
                this.uuid=row.recordId;
                this.link="../upload/annex.html?uuid="+this.uuid+"&flag=0";
                this.checkdialogForm = true;
                this.checksupervisionrecord = row;
            },
            clearForm(){
                this.gonggao.title = ''; // 拟制公告标题
                this.gonggao.relationId = '';
                this.gonggao.publicState = '';
                this.gonggao.publicType = '';
                this.gonggao.attachContent = '';
            },
            // 拟制公告
            gongGao(index,row){
                this.dialogGongGaoForm = true;
                this.viewsupervisionrecord = row;
                this.getUuid();
            },
            viewgongGao(index,row){
                this.dialogGongGaoViewForm = true;
                axios({
                    method: 'get',
                    url:'/dzjap/publick/getGlPublick',
                    params: {
                        relationId: row.recordId
                    }
                })
                    .then(response => {
                    let data = response.data;
                if (data.code == 200) {
                    let rowdata = response.data.data;
                    this.clearForm(); // 重置
                    this.uuid = response.data.data.publicId;
                    this.link="../upload/annex.html?uuid="+this.uuid+"&flag=0";
                    this.gonggao = rowdata;
                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            // 拟制公告--发布
            release(){
                this.gonggao.relationId = this.viewsupervisionrecord.recordId;
                this.gonggao.publicId=this.uuid;
                this.gonggao.attachContent = this.gonggao.attachContent.replace(/[\n\r]/g,'<br/>');
                axios({
                    method: 'post',
                    url: '/dzjap/regionrecord/addHandle',
                    data: this.gonggao
                })
                    .then(response => {
                    console.log(response);
                if (response.data.code == 200) {
                    // 拟制公告--发布成功
                    this.getData();
                    this.$message({
                        type: 'success',
                        message: '拟制公告发布成功!'
                    });
                    this.dialogGongGaoForm = false;
                    this.clearForm(); // 重置

                } else {
                    this.$message.error(data.msg);
                }
            })
            .catch(function (error) {
                    console.log(error);
                });
            },
            addAddress(){
            	axios.get('../../json/ChinaCity.json').then(res=>{
					this.address.forEach((item, index) => {
	                    item.provinceData = res.data;
	                })
				}).catch(e => {
					this.$message.error("网络连接超时");
			   })
            	this.address.push({
            		provinceValue:'',
	                cityValue:'',
	                areaValue:'',
	                provinceData:[],
                	cityData:[],
                	areaData:[],
            	})
            },
            delAddress(index,item){
            	this.address.splice(index, 1);
            },
            chooseProvince(item){
            	console.log(item)
            	console.log(item.provinceValue)
				item.cityValue='';
            	item.areaValue='';
                this.newcityValue = '';
                this.newareaValue = '';
                item.cityData = [];
                item.areaData = [];
                item.provinceData.map(e=>{//遍历数据
                    if( item.provinceValue == e.name){
                    item.cityData = e.cityList;
                    return;
                }
            })
                this.newprovinceValue = item.provinceValue;
            },
            chooseCity(item){
            	console.log(item)
            	console.log(item.cityValue)
				item.areaValue='';
                this.newareaValue = '';
                item.cityData.map(e=>{//遍历数据
                    if( item.cityValue == e.name){
                    item.areaData = e.areaList;
                    return;
                }
            })
                this.newcityValue = item.cityValue;

            },
            chooseArea(item){
                console.log(item)
                console.log(item.areaValue) 
                console.log(this.address)              
            },
            changeValuetype(value){
            	console.log(value)
            	if(value == '0' || value == '3'){
            		this.LandType = '0';
            	}else{
            		this.LandType = '1';
            	}
            },
            // 验证字符串是否电话号
            checkTel(str) {
                let re = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
                if (re.test(str)) {
                    return true;
                } else {
                    return false;
                }
            },
            //验证非负浮点数值
            checkNum(str){
                let re=/^\d+(\.\d+)?$/;
                if (re.test(str)) {
                    return true;
                } else {
                    return false;
                }
            },
            //验证营业执照或证件三合一
            checkCard(str){
                let re=/(^(?:(?![IOZSV])[\dA-Z]){2}\d{6}(?:(?![IOZSV])[\dA-Z]){10}$)|(^\d{15}$)/;
                if (re.test(str)) {
                    return true;
                } else {
                    return false;
                }
            }
        }
    })
</script>
</body>
</html>